import axios from 'axios';
const Q = require('q');

// module.exports
// exports.default
// export const insurance
export const insurance = {

  posturly:'http://127.0.0.1:8090/',   // 远程设备
  posturls:'http://47.98.31.90:88/api/',   // 远程设备
  posturl2:'http://47.96.67.141:10045/',  // 俞接口地址

  // 登录
  insuranceLogin:function(data){
    var deferred = Q.defer();
    axios({
      method:'POST',
      url: this.posturl2+'user/login',
      headers:{'Content-Type':'application/json;charset=utf-8'},
      data:data,
    }).then(function (response) {
      deferred.resolve(response.data);
    }).catch(function (error) {
      console.log(error)
    });
    return deferred.promise;
  },


};



// module.exports = app;
//   this.Api.post('user/login.do(地址)', {
//   "参数名": "参数值"
// }, response => {
//   if (response.status >= 200 && response.status < 300) {
//     console.log(response.data);\\请求成功，response为成功信息参数
//   } else {
//     console.log(response.message);\\请求失败，response为失败信息
//   }
// });
